package com.witmed.service.impl;

/**
 * @author hourenjie
 */
import java.util.List;
import com.witmed.dao.DoctorDao;
import com.witmed.dao.impl.DoctorDaoImpl;
import com.witmed.entity.Doctor;
import com.witmed.service.DoctorService;

public class DoctorServiceImpl implements DoctorService {

	private DoctorDao doctorDao = new DoctorDaoImpl();

	@Override
	public boolean getUpdate(Doctor doctor) {
		return doctorDao.update(doctor) == 1 ? true : false;
	}

	@Override
	public List<Doctor> getLogin(String doctorName, String doctorPassword) {
		return doctorDao.login(doctorName, doctorPassword);
	}

	/**
	 * 新增医生 chenxiangyang
	 * 
	 * @param doctor
	 * @return
	 */
	@Override
	public boolean insertDoctors(Doctor doctor) {
		// TODO Auto-generated method stub
		return doctorDao.insertDoctor(doctor) > 0 ? true : false;
	}

	/**
	 * 查询所有医生信息(包括科室，医院）
	 * 
	 * @return
	 */
	@Override
	public List<Doctor> findDoctors(String genre,String genres) {
		// TODO Auto-generated method stub
		return doctorDao.findDoctors(genre,genres);
	}

	@Override
	public boolean deleteByDoctorId(int doctorId) {
		// TODO Auto-generated method stub
		int i = doctorDao.deleteByDoctorId(doctorId);
		return i > 0 ? true : false;
	}

	@Override
	public List<Doctor> getPhoneLogin(String doctorTel) {
		// TODO Auto-generated method stub
		 return doctorDao.phoneLogin(doctorTel);
	}

}
